using System.Collections.Generic;

namespace Magiq.Tests.TestModel
{
    public class TestInheritanceDomain<TTestSuperClass, TTestSubClass> : ITestDomain<TTestSuperClass> where TTestSuperClass : ITestSuperClass<TTestSuperClass>, new()
                                            where TTestSubClass : ITestSubClass<TTestSuperClass>, TTestSuperClass, new()
    {
        public TestInheritanceDomain()
        {
            TestClassInstances = new List<TTestSuperClass>();
            ReferenceClassInstances = new List<ReferenceTestClass>();

            for (var i = 10; i < 15; i++)
            {
                ReferenceClassInstances.Add(new ReferenceTestClass
                                {
                                    StringProperty = "test" + i,
                                    IntProperty = i
                                });
            }
            for (var i = 100; i < 117; i++)
            {
                ReferenceClassInstances.Add(new ReferenceTestClass
                                {
                                    StringProperty = "lolo",
                                    IntProperty = i
                                });
            }


            for (var i = 0; i < 7; i++)
            {
                TestClassInstances.Add(new TTestSuperClass
                                {
                                    StringProperty = "test" + i,
                                    IntProperty = i,
                                    Reference = ReferenceClassInstances[i],
                                    AnotherIntProperty = i + 2,
                                    AnotherStringProperty = "pepe" + i,
                                    NullableIntProperty = i%2 == 0 ? i : (int?) null,
                                });
            }
            for (var i = 8; i < 10; i++)
            {
                TestClassInstances.Add(new TTestSubClass
                                {
                                    StringProperty = "test" + i,
                                    IntProperty = i,
                                    Reference = ReferenceClassInstances[i],
                                    AnotherIntProperty = i + 2,
                                    AnotherStringProperty = "pepe" + i,
                                    NullableIntProperty = i%2 == 0 ? i : (int?) null,
                                    InheritorProperty = "testing" + (i + 7)
                                });
            }
            for (var i = 0; i < 5; i++)
            {
                TestClassInstances.Add(new TTestSuperClass
                                {
                                    StringProperty = "sarasa",
                                    IntProperty = i,
                                    Reference = ReferenceClassInstances[i],
                                    NullableIntProperty = i%2 == 0 ? i : (int?) null,
                                    AnotherIntProperty = i + 1,
                                    AnotherStringProperty = "qwerty",
                                    SelfReference = TestClassInstances[i]
                                });
            }
            for (var i = 8; i < 15; i++)
            {
                TestClassInstances.Add(new TTestSubClass
                                {
                                    StringProperty = "sarasa",
                                    IntProperty = i,
                                    Reference = ReferenceClassInstances[i],
                                    NullableIntProperty = i%2 == 0 ? i : (int?) null,
                                    AnotherIntProperty = i + 1,
                                    AnotherStringProperty = "qwerty",
                                    InheritorProperty = "pp"
                                });
            }
            TestClassInstances.Add(new TTestSuperClass
                            {
                                StringProperty = "sarasa",
                                IntProperty = 5,
                                Reference = ReferenceClassInstances[4],
                                NullableIntProperty = 2,
                                AnotherIntProperty = 4,
                                AnotherStringProperty = "sarasala"
                            });
            TestClassInstances.Add(new TTestSubClass
                            {
                                StringProperty = "sarasa",
                                IntProperty = 5,
                                Reference = ReferenceClassInstances[4],
                                NullableIntProperty = 2,
                                AnotherIntProperty = 4,
                                AnotherStringProperty = "sarasala",
                                InheritorProperty = "sarasasasa"
                            });
            TestClassInstances.Add(new TTestSuperClass
                            {
                                StringProperty = null,
                                IntProperty = 5,
                                Reference = null,
                                NullableIntProperty = null,
                                AnotherIntProperty = 4,
                                AnotherStringProperty = "sarasala"
                            });
            TestClassInstances.Add(new TTestSubClass
                            {
                                StringProperty = null,
                                IntProperty = 5,
                                Reference = null,
                                NullableIntProperty = null,
                                AnotherIntProperty = 4,
                                AnotherStringProperty = "sarasala",
                                InheritorProperty = null
                            });
        }

        public List<TTestSuperClass> TestClassInstances { get; private set; }

        public List<ReferenceTestClass> ReferenceClassInstances { get; private set; }
    }
}